﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Booking_Hotel.DBML;

namespace Booking_Hotel.DAL
{
    public class Supplier_ViTriDAO
    {
        ThanhBHotelDataContext tbk = new ThanhBHotelDataContext();

        public Supplier_Hotel_Vitri GetSupplier_Hotel_VitriByID(int ID)
        {
            return tbk.sp_Supplier_Hotel_VitriSelect(ID).SingleOrDefault();
        }

        public void addSupplier_Hotel_ViTri(Supplier_Hotel_Vitri shv)
        {
            Supplier_Hotel_Vitri add = new Supplier_Hotel_Vitri
            {
                Supplier_HotelID = shv.Supplier_HotelID,
                TenViTri = shv.TenViTri,
                Description = shv.Description
            };
            tbk.Supplier_Hotel_Vitris.InsertOnSubmit(add);
            tbk.SubmitChanges();
        }

        public void updateSupplier_Hotel_ViTri(Supplier_Hotel_Vitri shv)
        {
            Supplier_Hotel_Vitri update = tbk.Supplier_Hotel_Vitris.Single(ca => ca.Supplier_Hotel_VitriID == (int)shv.Supplier_Hotel_VitriID);
            {
                update.Supplier_Hotel_VitriID = shv.Supplier_Hotel_VitriID;
                update.Supplier_HotelID = shv.Supplier_HotelID;
                update.TenViTri = shv.TenViTri;
                update.Description = shv.Description;
            }
            tbk.SubmitChanges();


        }

    }
}